import React from 'react'
import { Table, Button } from 'antd'
import StandardStore from 'pages/serviceStandard/stores/standard'
import StateMixin from 'reflux-state-mixin'
export default React.createClass({
  mixins: [StateMixin.connect(StandardStore)],
  getInitialState() {
    return {
    }
  },
  handleModify(id) {
    this.props.modify(id);
  },
  handleDelete(id) {
    this.props.delete(id);
  },
  render() {
    const columns = [{
      title: '标准级别',
      dataIndex: 'standardLevel',
      key: 'standardLevel',
    }, {
      title: '响应时间',
      dataIndex: 'responseLimit',
      key: 'responseLimit',
    }, {
      title: '响应时间单位',
      dataIndex: 'responseUnit',
      key: 'responseUnit',
    }, {
      title: '处理时间',
      dataIndex: 'handleLimit',
      key: 'handleLimit',
    }, {
      title: '处理时间单位',
      dataIndex: 'handleUnit',
      key: 'handleUnit',
    }, {
      title: '操作',
      dataIndex: 'operation',
      key: 'operation',
      render: (text, record) => {
        return USER_INFO.root
            ? <div>
                <Button icon='copy' type="ghost"
                  onClick={this.handleModify.bind(this, record.id)}
                  className="licopy">
                    修改
                  </Button>
                <Button icon='delete' type="ghost"
                  onClick={this.handleDelete.bind(this, record.id)}
                  className="lidel">
                    删除
                  </Button>
               </div>
            : null
      }
    }];
    return (
      <div className="list-content" style={{ marginTop: 10 }}>
        <Table rowKey="id" pagination={false}
          dataSource={this.props.models} columns={columns} />
      </div>
    )
  }
})
